/* 
 * File:   VariableRandomKnockingStrategy.h
 * Author: root
 *
 * Created on December 6, 2008, 11:20 AM
 */

#ifndef _VARIABLERANDOMKNOCKINGSTRATEGY_H
#define	_VARIABLERANDOMKNOCKINGSTRATEGY_H

#include "KnockingStrategy.h"

class VariableRandomKnockingStrategy : public KnockingStrategy {
    
    int decisionCertainty;
    int knockingProbability;
    int probabilityChangeRate;
    
protected:
    
    virtual void setExecutionParameter(int index, int rangeFraction) {
        switch (index) {
            // Probability of knocking
            case 0: knockingProbability = rangeFraction;
            break;
            // Change rate of probability (%/turn) (1-20)
            case 1: probabilityChangeRate = ((20 * rangeFraction) / 100) + 1;
            break;
        }
    }

public:
    
    VariableRandomKnockingStrategy() 
    : KnockingStrategy(string("VariableRandomKnockingStrategy"), 2), decisionCertainty(3), knockingProbability(0), probabilityChangeRate(1) {}
    
    VariableRandomKnockingStrategy(int myWeight)
    : KnockingStrategy(myWeight), decisionCertainty(3), knockingProbability(0), probabilityChangeRate(1)
    {
    }
                
    virtual int getDecisionCertainty() {
//        return (100 * currentHandValue) / 28;  // Where the value ranks in the range of hand values
        return decisionCertainty;
    }
    
    virtual Strategy* getActiveInstance(int inst_weight) {
        return dynamic_cast<Strategy*>(new VariableRandomKnockingStrategy(inst_weight));
    }
    
    virtual void opponentMove(int opponent, const Move& move) {}
    virtual bool decideKnock(CCardStack*, const GameState*);

};

#endif	/* _VARIABLERANDOMKNOCKINGSTRATEGY_H */

